<?php

class vtcompiler_additions {
	
	function vtcalc( $param ){
		$str = ' echo vtcalc(\'' . addcslashes( $param, '\'' ) . '\'); ';
		return $str;
	}

	function vtresult(){
		$str = ' echo $vt[\'result\']; ';
		return $str;
	}

	function vtif( $param ){
		$str = ' if( vtif_test( \'' . addcslashes( $param, '\'' ) . '\' ) ){ ';
		return $str;
	}

	function vtelse(){
		$str = ' } else { ';
		return $str;
	}
	
	function vtendif(){
		$str = ' } ';
		return $str;
	}
	
	function vtitem(){
		$str  = ' echo trim( current( $vt[\'repeat\'][0] ) ); ';
		return $str;
	}
	
	function vtrepeat( $param ){
		$str  = ' vtrepeat_init(\'' . addcslashes( $param, '\'' ) .'\' ); ';
		$str .= ' while( current( $vt[\'repeat\'][0] ) ) { ';
		return $str;
	}
	
	function vtendrepeat(){
		$str = ' next( $vt[\'repeat\'][0] ); ';
		$str .= '}';
		$str .= ' array_shift( $vt[\'repeat\'] ); ';
		return $str;
	}
}

?>